﻿Imports AccesoDatos

Public Class MultiBonificacion
#Region "chaves"

    Public Shared Function obtenerBonificacionMeta(ByVal p_codigoUsuario As String) As Double
        Dim sql As String
        Dim pars(0) As Parametro
        Dim dr As IDataReader

        sql = "select bonificacion_meta from t_bonificacion where codigo_empleado = p_codigoUsuario"

        pars(0) = New Parametro("p_codigoUsuario", p_codigoUsuario)

        dr = g_access.ejecutarQuery(sql, pars)

        If dr.Read() Then
            Return dr.Item(0)
        End If
    End Function

    Public Shared Function obtenerBonificacionGeneral(ByVal p_codigoUsuario As String) As Double
        Dim sql As String
        Dim pars(0) As Parametro
        Dim dr As IDataReader

        sql = "select bonificacion_general from t_bonificacion where codigo_empleado = p_codigoUsuario"

        pars(0) = New Parametro("p_codigoUsuario", p_codigoUsuario)

        dr = g_access.ejecutarQuery(sql, pars)

        If dr.Read() Then
            Return dr.Item(0)
        End If
    End Function

    Public Shared Sub actualizarBonificacionMeta(ByVal p_codigoUsuario As String, ByVal p_bonificacion As Double)
        Dim sql As String
        Dim pars(0) As Parametro
        '
        sql = "UPDATE t_bonificacion SET bonificacion_meta = p_bonificacion where codigo_empleado = p_codigoUsuario"
        '
        pars(0) = New Parametro("p_codigoUsuario", p_codigoUsuario)
        '
        g_access.ejecutarSQL(sql, pars)
    End Sub

    Public Shared Sub actualizarBonificacionGeneral(ByVal p_codigoUsuario As String, ByVal p_bonificacion As Double)
        Dim sql As String
        Dim pars(1) As Parametro
        '
        sql = "UPDATE t_bonificacion SET bonificacion_general = p_bonificacion where codigo_empleado = p_codigoUsuario"
        '
        pars(0) = New Parametro("p_codigoUsuario", p_codigoUsuario)
        pars(0) = New Parametro("p_bonificacion", p_bonificacion)
        '
        g_access.ejecutarSQL(sql, pars)
    End Sub

#End Region
End Class
